// import Storage from '../../../tool/storage'
module.exports = {
  save: function (key, data) {
    localStorage.setItem(key, JSON.stringify(data))
  },
  read: function (key) {
    var tmp = localStorage.getItem(key)
    return JSON.parse(tmp)
  },
  clean: function () {
    localStorage.clear();
  },
  saveUserInfo: function (uid, passWord, token) {
    var userInfo = {}
    userInfo.uId = uid
    userInfo.passWord = passWord
    userInfo.token = token
    this.save('userInfo', userInfo)
  },
  getUserInfo: function () {
    var userInfo = this.read('userInfo')
    if (userInfo == null) {
      userInfo = {}
      userInfo.token = '0000'
      userInfo.uId = '0000'
      userInfo.passWord = '0000'
    }
    return userInfo
    //userInfo.token = token;
    //userInfo.uId = self.userName;
    //userInfo.passWord = self.passWord;
  }
};
